export default class Stack {
    private items: any[] = [];
    // 将元素入栈
    public push(item: any): void {
        this.items.push(item);
    }
    // 出栈
    public pop(): any {
        return this.items.pop();
    }
    // 查看栈顶元素
    public peek(): any {
        return this.items[this.items.length - 1];
    }
    // 判断栈是否为空
    public isEmpty(): any {
        return !this.items.length;
    }
    // 栈中元素的个数
    public size(): number {
        return this.items.length;
    }
    // toString 12 235 25
    public toString(): string {
        return this.items.join(" ");
    }
}

